export function saveAlbumSetting() {
	return new Promise((resolve, reject) => {
			uni.getSetting({ //获取用户的当前设置
				success: (res) => {
					if (res.authSetting['scope.writePhotosAlbum']) { //验证用户是否授权可以访问相册
						resolve("授权成功")
					} else {
						uni.authorize({ //如果没有授权，向用户发起请求
							scope: 'scope.writePhotosAlbum',
							success: () => {
								resolve("授权成功")
							},
							fail: () => {
								uni.showModal({
									content: '检测到您没打开保存图片的权限，是否去设置打开？',
									confirmText: "确认",
									cancelText: '取消',
									success: (res) => {
										if (res.confirm) {
											uni.openSetting({
												success: (res) => {}
											})
										} else {
											console.log('取消');
											reject('授权取消');
										}
									}
								})
								setTimeout(() => {
									uni.openSetting({ //调起客户端小程序设置界面,让用户开启访问相册
										success: (res2) => {
											// console.log(res2.authSetting)
										}
									});
								}, 3000);
							}
						})
					}
				}
			})

		})
	}

